package com.lb.base.constants;

import com.alibaba.fastjson.JSONObject;
import com.lb.base.util.ClassPathUtils;

import java.time.Duration;

import static com.lb.base.constants.BaseConstants.JSON_FILE_SUFFIX;
import static com.lb.base.constants.BaseConstants.*;


/**
 * Redis 相关常量
 *
 * @author xiemingzhi
 * @since 1.0
 */
public class RedisConstants {

    public static final String REDIS_KEY_PREFIX_SN = "sn_";

    public static final String REDIS_CONFIG_JSON_DEFAULT = "redis-config-json-default";
    public static final String REDIS_CONFIG_JSON_FILE_NAME = REDIS_CONFIG_JSON_DEFAULT + JSON_FILE_SUFFIX;
    public static final JSONObject REDIS_CONFIG_JSON_OBJECT = ClassPathUtils.readJSONObject(REDIS_CONFIG_JSON_FILE_NAME);
    public static final String JSON_KEY_DEFAULT = "default";

    public static final Duration EXPIRE_TEN_SEC = TEN_SEC;
    public static final Duration EXPIRE_ONE_MIN = ONE_MIN;
    public static final Duration EXPIRE_FIVE_MIN = Duration.ofMinutes(5);
    public static final Duration EXPIRE_30_MINS = Duration.ofMinutes(30);
    public static final Duration EXPIRE_ONE_HOUR = Duration.ofHours(1);
    public static final Duration EXPIRE_TWO_HOURS = Duration.ofHours(2);
    public static final Duration EXPIRE_THREE_HOURS = Duration.ofHours(3);
    public static final Duration EXPIRE_ONE_DAY = ONE_DAY;
    public static final Duration EXPIRE_TWO_DAYS = Duration.ofDays(2);
    public static final Duration EXPIRE_THREE_DAYS = Duration.ofDays(3);
    public static final Duration EXPIRE_ONE_WEEK = Duration.ofDays(7);
    public static final Duration EXPIRE_TWO_WEEK = Duration.ofDays(14);
    public static final Duration EXPIRE_30_DAYS = Duration.ofDays(30);
    public static final Duration EXPIRE_60_DAYS = Duration.ofDays(60);
    public static final Duration EXPIRE_180_DAYS = Duration.ofDays(180);
    public static final Duration EXPIRE_ONE_YEAR = Duration.ofDays(365);

    public static class Test {

        public static final String TEST_EXPIRED = "test_expired_";

    }

}
